<template>
  <v-app id="inspire">
    <v-content>
      <v-container fluid>
        <h1 style="text-align: center;">Invitation I Sent</h1>
        <displayList
          :_items="invitationISent"
          :_item-per-page="4"
        >
        </displayList>
<side-bar></side-bar>
      </v-container>
    </v-content>
  </v-app>
</template>

<script>
import store from '../../store'
import SideBar from './SideBar'
import DisplayList from '../DisplayList'
export default {
  name: 'InvitationISent',
  components: {
    SideBar,
    DisplayList
  },
  data () {
    const generateInvitationISent = _ => {
      const contributions = []
      this.$axios.post('/invitationISent', store.state.userName)
        .then(resp => {
          if (resp != null) {
            var response = resp.data
            response.forEach((invitation, index) => {
              contributions.push({
                meetingFullName: invitation.meetingFullName,
                toUsername: invitation.toUsername,
                statusMessage: invitation.status === 0 ? '未处理' : (invitation.status === 1) ? '已接受' : '已拒绝'
                // topics: contribution.topics
              })
            })
            return contributions
          } else return null
        })
        .catch(error => {
          console.log(error)
        })
      return contributions
    }
    return {
      invitationISent: generateInvitationISent()
    }
  }
}
</script>
